﻿<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="/css/admin.css" rel="stylesheet" type="text/css">
<title>文章管理页面</title>
<script language="JavaScript" src="/js/forbidNew.js" type="text/JavaScript"></script>
<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/js/swfobject.js"></script>
<script type="text/javascript" src="/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/ckeditor/_samples/sample.js"></script>
<script type="text/javascript">
$(function(){
	$('#content').ckeditor();
	init();
});
function submitForm(){$('#frmDemo').submit();}
</script>
<script language="JavaScript">
function doSave()
{
	EditForm.displaytime.value=getDisplayTime();
	if(doCheck())
	{
		if(EditForm.cid.value!="")EditForm.parameter.value="update";
		//EditForm.content.value=htmlEdit.getHTML();
	}else{
		return false;
	}
	EditForm.submit();
}
function getDisplayTime()
{
var year,month,day,hour,minute;
var d=new Date();
if(EditForm.displayYear.value=="")
year=d.getYear();
else year=EditForm.displayYear.value;
if(EditForm.displayMonth.value=="")
month=d.getMonth()+1;
else month=EditForm.displayMonth.value;
if(EditForm.displayDay.value=="")
day=d.getDate();
else day=EditForm.displayDay.value;

if(EditForm.displayHour.value=="")
hour=d.getHours();
else hour=EditForm.displayHour.value;

if(EditForm.displayMinute.value=="")
minute=d.getMinutes();
else minute=EditForm.displayMinute.value;
return year+"-"+month+"-"+day+ " "+hour+":"+minute+":0";

}
function getNowTime(){
var year,month,day,hour,minute;
var d=new Date();
year=d.getYear();
month=d.getMonth()+1;
day=d.getDate();
hour=d.getHours();
minute=d.getMinutes();
return year+"-"+month+"-"+day+ "-"+hour+"-"+minute;
}
function doDel()
{
if(EditForm.cid.value!="")
{
if(confirm("信息删除后不能恢复，请问要执行删除操作吗？"))
{
EditForm.parameter.value="manageDel";
EditForm.submit();
}
}
else{
 alert("请选择要删除的数据");
}
}
function doCheck()
{
if(EditForm.title.value=="")
{
alert("标题不能为空!");
EditForm.title.focus();
return false;
}
return true;
}
function doUpload(obj,upFrame,types)
{
upFrame.EditForm.subCommand.value="NewsContent";
if(upFrame.EditForm.file.value!="")
{
upFrame.EditForm.parentObj.value=obj.name;
upFrame.EditForm.types.value=types;
upFrame.EditForm.submit();
}
}
function addAttach(type,value)
{
//alert(obj.value);
var obj;
if(type=="imgs")obj=EditForm.imgs;
else obj=EditForm.files;
if(obj.value.indexOf(value)<0)
{
if(obj.value!="")obj.value+=","+value;
else obj.value=value;
}
}
function addOptions(obj,value,text)
{
alert(value);
var sel=eval("EditForm."+obj);
for(var i=0;i<sel.options.length;i++)
{
if(sel.options[i].text==text)sel.options[i]=null;
}
var it=new Option(text,value);
sel.options[sel.options.length]=it;
}
function insertImgs()
{
//alert(EditForm.imgsSelect.value);
var imgPath=EditForm.imgsSelect.value;
htmlEdit.insertHTML("<img src='/upfile/"+imgPath+"' border=0>");
}
function init()
{
var nowyear=new   Date().getYear();   
setSelectValue(EditForm.displayYear,1999,nowyear);
setSelectValue(EditForm.displayMonth,1,12);
setSelectValue(EditForm.displayDay,1,31);
setSelectValue(EditForm.displayHour,1,24);
setSelectValue(EditForm.displayMinute,1,60);		
//window.setTimeout('initValue()',500);
initValue();
}
function initValue()
{
		//tmlEdit.setHTML(contentSpan.innerHTML);
		if(EditForm.displaytime.value=="")
		{		
		EditForm.displaytime.value=getNowTime();
		}
		var s=EditForm.displaytime.value.split("-");
		EditForm.displayYear.value=s[0];
		EditForm.displayMonth.value=s[1];
		EditForm.displayDay.value=s[2];
		EditForm.displayHour.value=s[3];
		EditForm.displayMinute.value=s[4];
}
function setSelectValue(sel,begin,end)
{
sel.options.length=1;
for(var i=begin,j=0;i<=end;i++,j++)
{
var op=new Option(i,i);
sel.options[j]=op;
}
}
function changeDetailSetting()
{
detailSetting.style.display=(detailSetting.style.display=="none"?"":"none");
}



</script>
</head>
<body onLoad="init();">

<form id="EditForm" name="EditForm" method="post" action="/blogNewsDoc.do">

<!--
<form id="EditForm" name="EditForm" method="post" action="/fckeditor/sampleposteddata.jsp">
-->
<table width="99%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
	<tr>
		<td height="38" align="center" valign="bottom"><table width="96%" height="34"  border="0" cellpadding="0" cellspacing="0">
				<tr>
					<td valign="middle"><table width="53%"  border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="10%" valign="bottom"><img src="/images/newsDir.jpg" width="32" height="32"></td>
								<td width="90%" class="titletxt">编辑文章</td>
							</tr>
						</table></td>
					<td width="100">&nbsp;</td>
					<td width="120">&nbsp;</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td height="40" align="center" valign="middle"><table width="96%" height="100%"  border="0" cellpadding="0" cellspacing="0" class="toolTable">
				<tr>
					<td width="5">&nbsp;</td>
					<td width="55" align="left" valign="middle"><input type="submit" name="Submit" value="保存" onClick="return doSave();" class="colorButton"></td>
					<td width="55" align="left" valign="middle"><input type="button" name="Submit2" value="删除" onClick="doDel();" class="colorButton"></td>
					<td width="55" valign="middle"><input type="button" name="Submit3" value="返回" onClick="history.go(-1)" class="colorButton"></td>
					<td width="27" valign="middle">&nbsp;</td>
					<td width="28" valign="middle">&nbsp;</td>
					<td width="55" valign="middle">&nbsp;</td>
					<td valign="middle">&nbsp;</td>
				</tr>
			</table></td>
	</tr>
	<tr>
		<td align="center" valign="top">
				<input type="hidden" name="parameter" value="add">
				<input type="hidden" name="cid"   value="$!cid">
				<input type="hidden" name="page"   value="$!page">
				<input type="hidden" name="displaytime"  value="$!CommUtil.formatDate('yyyy-M-d-H-m',$!displaytime)">
				<table width="96%"   border="0" cellpadding="1" cellspacing="0">
					<tr  >
						<td width="73" height="23" align="right">标 题 </td>
						<td colspan="3"><font color="#FF0000">
							<input name="title" type="text" id="title" value="$!title" style="width:80%">
							*</font></td>
					</tr>
					<tr>
						<td width="73" height="23" align="right">分 类</td>
						<td width="188" align="left">
						<select name="dirSn" style="width:100px;">
								<option value="">默认分类</option>								  $!TagUtil.options($dirService.queryBlogNewsDir($!inputuser,1,15).result,"cid","title",$dirSn)
							</select>
							<select id="circlesn" name="circlesn">
								<option value="">发表到圈子</option>
			$!TagUtil.options($circleService.queryAllUserCircle($currentUser.userName).result,"cid","title",$circlesn)
							</select>
							</td>
						<td width="52" align="right">发布时间</td>
						<td width="418" align="left">
						<select name="displayYear">
							</select>
							年
							<select name="displayMonth">
							</select>
							月
							<select name="displayDay">
							</select>
							日
							<select name="displayHour">
							</select>
							时
							<select name="displayMinute">
							</select>
							分</td>
					</tr>
					<tr>
						<td width="73" align="right">来 源</td>
						<td colspan="3"><font color="#FF0000">
							<input name="source" type="text" id="source" value="$!source" style="width:80%">
							</font></td>
					</tr>
					<tr>
						<td width="73" align="right">作 者</td>
						<td colspan="3"><font color="#FF0000">
							<input name="inputuser" type="text" id="inputuser" value="$!inputuser" style="width:80%">
							</font></td>
					</tr>
					<tr>
						<td width="73" align="right" >评 论</td>
												<td><input type="radio" name="review" value="1" checked
												#if($!enableReview==1&&$!guestReview==1)
												checked
												#end
												>
													允许
													<input type="radio" name="review" value="0"
													#if($!enableReview==1&&$!guestReview==-1)
												checked
												#end
													>
													不允许匿名
													<input type="radio" name="review" value="-1"
													#if($!enableReview==-1)
												checked
												#end
													>
													禁止</td>
					</tr>
					<tr >
									<td align="right" valign="top">文章简介</td>
									<td colspan="3"    class="formText"><textarea name="intro" rows="3" class="smallInput" id="textarea" style="width:100%">$!intro</textarea ></td>
					</tr>
					<tr>
                                                       <td align="right" valign="top">内容</td>
                                                      
						       <td colspan="3">
							<div>
								<textarea name="content" id="content" style="width:100%">$!content</textarea>
								<input id="ifblank" name="ifblank" type="checkbox" style="display:none;">
							</div>
							</td>
					</tr>
				</table>
			</td>
	</tr>
</table>
</form>
</body>
</html>
#if ($msg)
<script>
alert('$!msg');</script>
#end